<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<html lang="en">
<html>
<head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
</head>
<body>
<form >
    <input type="hidden" name="roleId" id="roleId" th:value="${tRole.roleId }">
    角色：<input id="roleName" name="roleName" th:value="${tRole.roleName }"><br>
    <div class="content_wrap">
        <div class="zTreeDemoBackground left">
            <ul id="treeDemo" class="ztree"></ul>
        </div>
    </div>
</form>
</body>
<script type="text/javascript">

    //根据角色ID 去查权限ID
    var roleId = $("#roleId").val();
    //创建配置  角色绑定权限
    var setting = {
        async: {
            enable: true,
            url: "/menuController/getzCheckedTree/"+roleId,
            autoParam: ["id", "name"]
        },
        data: {
            simpleData: {
                enable: true
            }
        },check: {
            enable: true,
            chkStyle: "checkbox",
            chkboxType: { "Y": "p", "N": "s" }
        }
    };



    //初始化树
    $(document).ready(function(){
        $.fn.zTree.init($("#treeDemo"), setting);
    });
</script>
</html>